﻿Imports System
Imports System.ComponentModel
Imports System.Reflection
Imports System.Resources

<AttributeUsage(AttributeTargets.All)> _
Friend NotInheritable Class SRCategoryAttribute
    Inherits CategoryAttribute
    ' Methods
    Public Sub New(ByVal category As String)
        MyBase.New(category)
        Me.resourceSet = String.Empty
    End Sub

    Public Sub New(ByVal category As String, ByVal resourceSet As String)
        MyBase.New(category)
        Me.resourceSet = String.Empty
        Me.resourceSet = resourceSet
    End Sub

    Protected Overrides Function GetLocalizedString(ByVal value As String) As String
        If (Me.resourceSet.Length > 0) Then
            Dim manager As New ResourceManager(Me.resourceSet, Assembly.GetExecutingAssembly)
            Return manager.GetString(value)
        End If
        Return SR.GetString(value)
    End Function


    ' Fields
    Private resourceSet As String
End Class


